package IOStream.CharStream;

import java.io.FileReader;
import java.io.IOException;

/**
 * ClassName:CharStream002
 * Package:IOStream.CharStream
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/3/1-21:22
 * @Version:v1.0
 */
public class CharStream002 {
    /***/
    public static void main(String[] args) throws IOException {
        //创建对象
        FileReader fr = new FileReader("E:\\aaa\\a.txt");
        //读取数据
        char[] chars = new char[2];
        int len;
        //read(char)细节：读取数据,解码,强转三歩合并了,把强转之后的字符放到数组当中
        //空参的read+强转类型转换
        //
        while ((len = fr.read(chars)) != -1) {
            //把数组中的数据变成字符串进行打印
            System.out.println(new String(chars,0,len));

        }
        fr.close();
    }
}
